﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;

namespace manage
{
    /// <summary>
    /// testdata 的摘要说明
    /// </summary>
    public class testdata : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            StringBuilder sb = new StringBuilder();
            string page = context.Request.QueryString["page"];
            sb.Append("[");
            sb.Append("{id:\"1\",name:\"Desktop Computer\",note:\"note\",stock:\"Yes\",ship:\"FedEx\", sdate:\"2007-12-03\"},");
            sb.Append("{id:\"2\",name:\"Laptop\",note:\"Long text \",stock:\"Yes\",ship:\"InTime\",sdate:\"2007-12-03\"},");
            if ("2".Equals(page))
            {
                sb.Append("{id:\"3\",name:\"LCD Monitor\",note:\"note3\",stock:\"Yes\",ship:\"TNT\",sdate:\"2007-12-03\"},");
                sb.Append("{id:\"4\",name:\"Speakers\",note:\"note\",stock:\"No\",ship:\"ARAMEX\",sdate:\"2007-12-03\"},");
            }
            sb.Append("{id:\"23\",name:\"Speakers\",note:\"note\",stock:\"No\",ship:\"ARAMEX\",sdate:\"2007-12-03\"}");
            sb.Append("]");
            context.Response.ContentType = "text/javascript";
            context.Response.Charset = "utf-8";
            context.Response.Write(sb.ToString());
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}